<?php
// ----------------------------------------------------------
// * @Copyright @ 2011-2020 By HuaXiaXinCai
// ----------------------------------------------------------
// * @Author Yang Changwu<800334@qq.com> 2017-05-13
// ----------------------------------------------------------
namespace Controller;
use \GatewayWorker\Lib\Gateway;
use \Controller\Core;

class Diy extends Core{
    //获取投注中奖排行
    public function DiyAward($data,$client_id){
        //查询当前期次
        $period = $this->db->select('*')->from('sz_period')->where('status=0')->orderByASC(array('id'),false)->row();
        if($period){
            $award_number = $data['awardnumber'];
            $this->db->update('sz_period')->cols(array('awardnumber'=>$award_number))->where("id=".$period['id'])->query();
            $msg = [
                'method' => 'DiyAward',
                'data' => 'ok',
            ];
            return self::SendMsg(1001,$msg);
        }else{
            $msg = [
                'method' => 'DiyAward',
                'data' => 'error',
            ];
            return self::SendMsg(1002,$msg);
        }
    }
}